<?php use_helper('Javascript') ?>
<?php echo javascript_tag("
  function gotoLink(link)
  {
     document.location.href=link;
  }
") ?>

<table id="buglist">
	<tr>
		<th>ID</th>
		<?php foreach($columns as $column): ?>
		<th><?php echo str_ireplace('_', ' ', strtoupper($column[0]) . substr($column, 1)) ?></th>
		<?php endforeach ?>
	</tr>
	<?php foreach($bugs as $i => $bug):?>
	<tr class="<?php echo ($i % 2 == 0) ? 'even' : 'odd' ?> hover" onmouseover="this.style.cursor='pointer';" onclick="gotoLink('<?php echo $bug->getUrl() ?>')">
		<td><?php echo $bug->getID() ?></td>
		<?php foreach($columns as $column): ?>
			<td>
				<?php
					$getter = 'get'.strtoupper($column[0]).substr($column, 1);
					$toPrint = $bug->$getter();
					if (!$toPrint)
					{
						echo '<i>No '.strtoupper($column[0]).substr($column, 1).'</i>';
					}
					else
					{
						$toPrint = (strlen($toPrint) > 75) ? substr($toPrint, 0, 60).'...' : $toPrint;
						echo $toPrint;
					}
				?>
			</td>
		<?php endforeach ?>
	</tr>
	<?php endforeach ?>
</table>